package com.michael.study.jetpack.db.dao

import androidx.room.*
import com.michael.study.jetpack.bean.User

/**
 * Description:
 *
 * Created by liuguoquan on 2020/6/29 13:56.
 */
@Dao
interface UserDao {

    @Insert
    fun insert(user: User): Long

    @Update
    fun update(user: User)

    @Query("select * from User")
    fun queryAllUsers(): List<User>

    @Query("select * from User where id = :id")
    fun queryUser(id: Long): User

    @Delete
    fun delete(user: User)


    @Query("delete from User where id = :id")
    fun deleteById(id: Long)

}